﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace Payroll
{
    public partial class DownloadPaied : Form
    {
        public DownloadPaied()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string path = textBox1.Text;

            if (Regex.IsMatch(path, "[A-Za-z0-9_\u4e00-\u9fa5].txt$"))//文件需要以.txt结尾
            {
                path = @"../../txtFolder/" + path;
                myFile.myDownload(path);

                string s1 = "否";
                string s2 = "";

                if (radioButton1.Checked)
                {
                    Cipher.Encryption(path);
                    s1 = "是";
                    s2 = "并加密成功！";
                }
                myFile.myWrite_operate(myUser.Name, "打印工资记录 路径: " + path + " 是否加密: " + s1);

                MessageBox.Show("已写入 " + path + "中！" + s2);
                Close();
            }
            else
            {
                MessageBox.Show("请输入以 .txt 为结尾的路径！","警告");
            }
        }
    }
}
